<form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th width = "5%" class="text-center">
                        <a href="javascript:sort('goods_id');">ID</a>
                    </th>
                    <th width = "20%" class="text-center">
                        <a href="javascript:sort('goods_name');">邀请码名称</a>
                    </th>
					<th width = "10%" class="text-center">
                        <a href="javascript:sort('cat_id');">类型</a>
                    </th>
                    <th width = "10%" class="text-center">
                        <a href="javascript:sort('number');">可使用次数</a>
                    </th>
                    <th width = "15%" class="text-center">
                        <a href="javascript:sort('use_number');">已使用次数</a>
                    </th>
                    <th width = "15%" class="text-center">
                        <a href="javascript:sort('add_time');">发布时间</a>
                    </th>
                    <th width = "15%" class="text-center">操作</th>
                </tr>
            </thead>
            <tbody>
                <volist name="newsList" id="list">
                    <tr>
                        <td style="line-height:34px;" class="text-center">{$list.id}</td>
                        <td width="400" style="line-height:34px;" class="text-center">{$list.title|getSubstr=0,33}</td>
						<td style="line-height:34px;" align="center">
							<if condition="$list['cat_id'] eq 1">
								卖家
							<else />
								买家
							</if>
						</td>
                        <td style="line-height:34px;" align="center">{$list.number}</td>
                        <td style="line-height:34px;" class="text-center">{$list.use_number} </td>
                        <td style="line-height:34px;" class="text-center">{$list.add_time|date="Y-m-d H:i:s",###} </td>
                        <td class="text-center">
                            <a href="{:U('Admin/News/addEditnews',array('id'=>$list['id'],'p'=>$_GET['p']))}" class="btn btn-primary" title="编辑"><i class="fa fa-pencil"></i></a>
							<a href="{:U('Admin/News/user',array('id'=>$list['id'],'p'=>$_GET['p']))}" class="btn btn-primary" title="会员列表"><i class="fa fa-user"></i></a>
							<a href="javascript:;" onclick="del('{$list[id]}')" class="btn btn-danger" title="删除"><i class="fa fa-trash-o"></i></a>
                        </td>
                    </tr>
                </volist>
            </tbody>
        </table>
    </div>
</form>
<div class="row">
    <div class="col-sm-3 text-left"></div>
    <div class="col-sm-9 text-right">{$page}</div>
</div>
<script>
// 点击分页触发的事件
$(".pagination  a").click(function() {
    cur_page = $(this).data('p');
    ajaxGetTable('search-form2', cur_page);
});
/*
 * 清除静态页面缓存
 */
function del(id){
	layer.confirm('确定删除吗?', {
	  btn: ['确定','取消'] //按钮
	}, function(){
		$.ajax({
			type: 'post',
			url: '/Admin/News/delnews',
			data: {
				id:id
			},
			dataType: 'json',
			success: function(data) {
				if (data.code==200) {
					ajaxGetTable('search-form2', cur_page);
				} else {
					layer.alert('删除失败', {
						icon: 2
					});
				}
			}
		});	
		layer.closeAll();
	}, function(){

	});
}
function clearGoodsHtml(goods_id) {
    $.ajax({
        type: 'GET',
        url: "{:U('Admin/System/clearGoodsHtml')}",
        data: {
            goods_id: goods_id
        },
        dataType: 'json',
        success: function(data) {
            layer.alert(data.msg, {
                icon: 2
            });
        }
    });
}
/*
 * 清除商品缩列图缓存
 */
function clearGoodsThumb(goods_id) {
    $.ajax({
        type: 'GET',
        url: "{:U('Admin/System/clearGoodsThumb')}",
        data: {
            goods_id: goods_id
        },
        dataType: 'json',
        success: function(data) {
            layer.alert(data.msg, {
                icon: 2
            });
        }
    });
}
</script>
